Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Place multiple bids on a name in same block #477

Merged
merged 7 commits into from
Jun 29, 2022

Conversation

rithvikvibhu
Copy link
Collaborator

Closes #179.

Demo (https://youtu.be/FNT78BhzhS4):
YouTube video

Changes made to make this happen:

  • Add getBlind to walletClient
  • While parsing pending transactions,
    • store an array in case of BID, leave other covenants as before
    • get true bid value from blind from output covenant item
  • reset input fields for true bid and blind in UI after sending a bid
  • change "place bid" button text to "place another bid" to emphasize that a bid has already been placed
  • BidHistory component to show pending bids differently (gray text, italics)
  • Move reducePendingTransactions from namesReducer.js to walletActions.js because it no longer "just" reduces, it also calls async function getBlind. It anyway did a lot more than a reducer should before also.

Also:

  • Update auction details / name info / bids on new blocks - no need to refresh screen or navigate away and come back anymore
  • Extract strings from modal on placing bids for i18n

Recommend squash and merge because commits aren't really separate.

@pinheadmz
Copy link
Contributor

Do you think we should alert the user if they are placing a duplicate bid?

@rithvikvibhu
Copy link
Collaborator Author

I initially thought that the big blue "placed bid" modal and the button changing text is enough, but going through the video again, yeah an explicit warning might be better.

@rithvikvibhu rithvikvibhu force-pushed the multi-bid-in-same-block branch from e95c1b2 to ca5a0cf Compare June 22, 2022 06:06
@rithvikvibhu
Copy link
Collaborator Author

@pinheadmz added that warning when one tries to bid again with the same value:
image

@brandondees
Copy link

might be a nice tweak to also extend the "another bid" copy change to all the other submit/confirm parts of the UI, not just the first button. it would be easy to open the dialogue, get distracted, then come back and forget that the open prompt is for an extra bid, especially if the first bid's state may have changed in a way the user was unsure about in the meantime.

map[bid.from] = {
date: createAMPMTimeStamp(bid.date),
date: bid.date ? `${month}/${day}/${year}` : '(pending)',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll probably have to revisit date/time formatting in I18n friendly way at some point. not important to focus on here, just observing

refreshInfo = throttle(async () => {
await this.props.getNameInfo(this.getDomain());
await this.props.fetchPendingTransactions();
}, 10*1000, {leading: true}) // 10 seconds

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this throttle rate based on some timeout defined elsewhere, or just an arbitrary rate?

does throttle handle the situation where the async function runs longer than 10 seconds? i.e. if it took 60 seconds to complete, would it fire up to 6-ish concurrent attempts, or would it wait for the first one to resolve before allowing the second to begin?

also, if i'm reading correctly, given the componentDidUpdate is async, and this function awaits on each line, is the async inside of throttle actually providing any benefit?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points. 10 seconds just seemed enough, since fetchPendingTransactions() is a local call and getNameInfo is small json and fixed in size (if local or even if remote over network).
I still don't like the idea of random numbers like this, but without a throttle, it will refresh every time the height changes (which can happen more than once a second when syncing). Open to other cleaner ideas.

given the componentDidUpdate is async, and this function awaits on each line

You're right, we don't really care when it finishes and 118 doesn't need 117 to finish first, so removed await (and async) so they can run in parallel.

Copy link

@brandondees brandondees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read through this PR and it looks like a really nice improvement. I added a couple non-blocking comments.

@rithvikvibhu rithvikvibhu force-pushed the multi-bid-in-same-block branch from ca5a0cf to c88f5d3 Compare June 23, 2022 06:03
@rithvikvibhu rithvikvibhu force-pushed the multi-bid-in-same-block branch from c88f5d3 to 51e7800 Compare June 29, 2022 17:30
@rithvikvibhu rithvikvibhu merged commit 6b284e0 into kyokan:master Jun 29, 2022
@rithvikvibhu rithvikvibhu deleted the multi-bid-in-same-block branch June 29, 2022 17:36
@rithvikvibhu rithvikvibhu removed the needs translation PR updates locale strings and have not yet been translated label Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature / Bug] UI should prevent double-submitting bids, but allow concurrent pending bids
3 participants